<?php
/**
 * Created by PhpStorm.
 * User: robot
 * Date: 2018-04-17
 * Time: 17:30
 */
namespace app\admin\validate;

use think\Validate;
class AddUserValidate extends Validate
{
    protected $rule = [
        'username|账号' => 'require|chsAlphaNum|max:15',
        'password|密码' => 'require|min:6',
        'usernick|昵称' => 'require|chsAlphaNum|max:15',
    ];
    protected $message = [
        'username.require' => '请输入账号',
        'username.chsAlphaNum' => '账号只能为汉字、字母、数字',
        'username.max' => '账号最多不超过15个字符',

        'usernick.require' => '请输入账号',
        'usernick.chsAlphaNum' => '账号只能为汉字、字母、数字',
        'usernick.max' => '账号最多不超过15个字符',

        'password.require' => '请输入密码',
        'password.min' => '密码最小长度为6个字符',
    ];
    protected $scene = [
        'edit' => ['usernick']
    ];
}